﻿@model List<Bk.Models.BlogInfo>
@{
    ViewBag.Title = "Login";
    Layout = null;
    var errorMsg = ViewBag.Error as string;
}

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Login</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
    <style>
        body {
            background: #f5f6fa;
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .login-card {
            background: #fff;
            border-radius: 16px;
            box-shadow: 0 4px 24px rgba(0,0,0,0.10);
            padding: 36px 32px 32px 32px;
            width: 350px;
            display: flex;
            flex-direction: column;
            align-items: stretch;
        }
        .login-title {
            font-size: 24px;
            font-weight: bold;
            text-align: center;
            margin-bottom: 6px;
        }
        .login-subtitle {
            font-size: 14px;
            color: #888;
            text-align: center;
            margin-bottom: 24px;
        }
        .input-label {
            font-size: 14px;
            color: #222;
            margin-bottom: 6px;
            margin-left: 2px;
        }
        .input-group {
            position: relative;
            margin-bottom: 20px;
        }
        .input-group input {
            width: 100%;
            padding: 12px 12px 12px 38px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            font-size: 15px;
            outline: none;
            background: #fafbfc;
            box-sizing: border-box;
            transition: border 0.2s;
        }
        .input-group input:focus {
            border: 1.5px solid #1976d2;
        }
        .input-group .fa {
            position: absolute;
            left: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: #bbb;
            font-size: 16px;
            pointer-events: none;
        }
        .remember-row {
            display: flex;
            align-items: center;
            margin-bottom: 20px;
        }
        .remember-row input[type="checkbox"] {
            margin-right: 6px;
        }
        .login-btn {
            width: 100%;
            background: #1976d2;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 12px 0;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            margin-bottom: 16px;
            transition: background 0.2s;
        }
        .login-btn:hover {
            background: #1565c0;
        }
        .register-link {
            text-align: center;
            font-size: 14px;
            color: #888;
        }
        .register-link a {
            color: #1976d2;
            text-decoration: none;
            margin-left: 4px;
        }
        .register-link a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="login-card">
        <div class="login-title">用户登录</div>
        <div class="login-subtitle">欢迎回来，请登录您的账户</div>
        @if (!string.IsNullOrEmpty(errorMsg))
        {
            <script>
                window.onload = function() {
                    alert('@errorMsg');
                };
            </script>
        }
        @using (Html.BeginForm("login", "default", FormMethod.Post, new { id = "frm" }))
        {
            @Html.AntiForgeryToken()
            <div class="input-label">用户名</div>
            <div class="input-group">
                <i class="fa fa-user"></i>
                @Html.TextBox("UserName", null, new { placeholder = "请输入用户名", autocomplete = "username" })
                <span style="color:red">@Html.ValidationMessage("UserName")</span>
            </div>
            <div class="input-label">密码</div>
            <div class="input-group">
                <i class="fa fa-lock"></i>
                @Html.Password("PassWord", null, new { placeholder = "请输入密码", id = "password", autocomplete = "current-password" })
                <span style="color:red">@Html.ValidationMessage("PassWord")</span>
            </div>
            <div class="remember-row">
                <input type="checkbox" id="rememberMe" name="rememberMe" />
                <label for="rememberMe" style="font-size:13px; color:#888;">记住我</label>
            </div>
            <button type="submit" class="login-btn">登录</button>
        }
        <div class="register-link">
            还没有账号？<a href="@Url.Action("Register", "Default")">立即注册</a>
        </div>
    </div>
</body>
</html>
